Registered S3 method overwritten by 'tsibble':
method from
as_tibble.grouped_df dplyr
Attaching package: 'tsibble'
The following object is masked from 'package:lubridate':
interval
The following objects are masked from 'package:base':
intersect, setdiff, union
library(ggplot2)library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
library(feasts)
Loading required package: fabletools
library(fabletools)library(zoo)
Attaching package: 'zoo'
The following object is masked from 'package:tsibble':
index
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
poudre_flow_tsibble <- poudre_flow |>as_tsibble(index = Date) |>fill_gaps()gg_subseries(poudre_flow_tsibble, Flow, na.rm =TRUE) +labs(title ="Subseries of Monthly Flow in Poudre River",y ="Flow (cfs)")
Warning: Removed 3746 rows containing missing values or values outside the scale range
(`geom_hline()`).
The seasons are defined according to the date (certain months/dates go to their respective seasons). Subseries represents group a particular series, like a dataset, into specific groups by category, such as season.
full_date_seq <-seq.Date(from =as.Date("2013-01-01"), to =as.Date("2023-12-31"), by ="month")poudre_flow_tsibble <- poudre_flow |>as_tsibble(index = Date) |>right_join(tibble(Date = full_date_seq), by ="Date") |>fill_gaps(.full =TRUE) |>mutate(Flow = zoo::na.approx(Flow, na.rm =FALSE))decomposed <- poudre_flow_tsibble |>model(STL =STL(Flow ~season(window =12) +trend(window =13)))decomposed |>components() |>autoplot() +labs(title ="STL Decomposition of Monthly Flow in Poudre River")
I see 5 graphs for flow, trend, season_year, season_week, and remainder. There are several flucuations in the data, mostly in 2014-2016 as well as 2021 - 2023. While Trend represents the general movement of water flow, the seasons represent the 12-month representation of how much water flows in each month/week.